package ysu.sxm.ptjc.Dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import ysu.sxm.ptjc.Domin.DateRange;
import ysu.sxm.ptjc.Domin.DefectReq;
import ysu.sxm.ptjc.pojo.*;

import java.util.List;
import java.util.Set;

@Repository
@Mapper
public interface DefectStatisticsDao {
/*    //测试xml
    List<ProduceInfo> testXmlIn(List<String> reqLine);
    //测试注解
    @Select("<script> select produce_num from pro_relation_info " +
            "<where> " +
            "<foreach collection=\"reqworkshopid\" item=\"workshopid\" open=\"workshop_id in (\" close=\")\" separator=\",\"> " +
            "#{workshopid}</foreach> </where> </script>")
    List<String> testAnoIn(List<String> reqworkshopid);*/
    /**
     *     获取条件下要查询的订单编号
     */
    List<String> getProduceNum(DefectReq defectReq);
    /**
     *     查询对应订单编号的缺陷描述编号
     */
    List<DefectTypeInfo> getDiscrapeId(@Param("pro_num") List<String> pro_num,int flag,@Param("dateRanges") List<DateRange> dateRanges);

    /**
     *查询小表
     */
    CastingDefectsInfo getCastingDefect(@Param("defectTypeInfos") List<DefectTypeInfo> defectTypeInfos);
    ExtrusionDefectInfo getExtrusionDefectInfo(@Param("defectTypeInfos") List<DefectTypeInfo> defectTypeInfos);
    MachiningDefectsInfo getMachiningDefectsInfo(@Param("defectTypeInfos") List<DefectTypeInfo> defectTypeInfos);
    PolishingDefectInfo getPolishingDefectInfo(@Param("defectTypeInfos") List<DefectTypeInfo> defectTypeInfos);
    OxidationDefectInfo getOxidationDefectInfo(@Param("defectTypeInfos") List<DefectTypeInfo> defectTypeInfos);
    AssemblyDefectInfo getAssemblyDefectInfo(@Param("defectTypeInfos") List<DefectTypeInfo> defectTypeInfos);
    CdpDefectInfo getCdpDefectInfo(@Param("defectTypeInfos") List<DefectTypeInfo> defectTypeInfos);
    /**
     * 查询生产量
     */
    long getProduceAll(@Param("produce_nums") List<String> produce_nums,@Param("dateRanges") Set<DateRange> dateRanges);
}
